from django import forms

class PasswordForm(forms.Form):
    username = forms.ChoiceField(choices=[['', '-----------------Select------------------'],['admin','admin'],['ftpuser','ftpuser']], required=True)
    oldpassword = forms.CharField(label=('Oldpassword'),widget=forms.PasswordInput(render_value=False),required=True)
    newpassword1 = forms.CharField(label=('Newpassword'),widget=forms.PasswordInput(render_value=False),required=True)
    newpassword2 = forms.CharField(label=('Confirmpassword'),widget=forms.PasswordInput(render_value=False),required=True)
        
    def clean_message(self):
        oldpassword = self.clean_data.get('oldpassword', '')
        if self.newpassword1 != self.newpassword2 :
            raise forms.ValidationError("Newpassword and Confirmpassword are not equal!")
        return oldpassword
